import fetch from '../utils/fetch.js';

// 注册接口
const registerApi = 'userRegister';
const loginApi = 'userLogin';
const getCodeApi = 'getCode';
const updateLoginPasswordApi = 'updateLoginPassword';
const updateNewPhoneApi = 'updateNewPhone';
const updatePayPasswordApi = 'updatePayPassword';
const findUserBlockListApi = 'findUserBlockList';
const getUserByIdApi = 'getUserById'
const updateUserOneApi = 'updateUserOne'
const userBlockApi = 'userBlock'
const deleteUserBlockApi = 'deleteUserBlock'
const getMyLikeListApi = 'getMyLikeList'
const userFollowApi = 'userFollow'
const deleteUserFollowApi = 'deleteUserFollow'
const getIsFollowApi = 'getIsFollow'
const forgetLoginPasswordApi = 'forgetLoginPassword'
const getIsTwoFollowApi = 'getIsTwoFollow'




class UserService {

	// 登录
	async loginService(data) {
		const logindata = await fetch(loginApi, data);
		return logindata
	}

	// 注册
	async registerService(data) {
		const registerdata = await fetch(registerApi, data);
		return registerdata
	}
	
	// 忘记密码
	async forgetLoginPasswordService(data) {
		const forgetdata = await fetch(forgetLoginPasswordApi, data);
		return forgetdata
	}
	// 获取验证码
	async getCode(params) {
		const code = await fetch(getCodeApi, params);
		return code
	}
	// 修改登录密码
	async updateLoginPassword(params) {
		const update = await fetch(updateLoginPasswordApi, params);
		return update
	}
	// 手机换绑
	async updateNewPhone(params) {
		const update = await fetch(updateNewPhoneApi, params);
		return update
	}
	// 设置支付密码
	async updatePayPassword(params) {
		const updatePay = await fetch(updatePayPasswordApi, params);
		return updatePay
	}
	// 黑名单列表
	async findUserBlockList(params) {
		const BlockList = await fetch(findUserBlockListApi, params);
		return BlockList
	}

	// 获取登录用户信息
	async getUserById(data) {
		const res = await fetch(getUserByIdApi, data);
		return res
	}

	// 编辑基本资料(注册后)
	async updateUserOne(data) {
		const res = await fetch(updateUserOneApi, data);
		return res
	}

	// 拉黑
	async userBlock(data) {
		const res = await fetch(userBlockApi, data);
		return res
	}
	// 移除拉黑
	async deleteUserBlock(data) {
		const res = await fetch(deleteUserBlockApi, data);
		return res
	}

	// 关注列表
	async getMyLikeList(params) {
		const likeList = await fetch(getMyLikeListApi, params);
		return likeList
	}


	// 关注
	async userFollow(data) {
		const res = await fetch(userFollowApi, data);
		return res
	}

	// 取消关注
	async deleteUserFollow(data) {
		const res = await fetch(deleteUserFollowApi, data);
		return res
	}
	// 获取改用户是否关注某人
	async getUserFollow(data) {
		const res = await fetch(getIsFollowApi, data);
		return res
	}
	// 获取是否互相关注
	async getIsTwoFollowApi(data) {
		const res = await fetch(getIsTwoFollowApi, data);
		return res
	}


}

export default new UserService()
